﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RedGlove.Lib;

namespace RGPWEB.share
{
    public partial class Site1 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!SessionBox.CheckUserSession())
                {
                    Panel1.Visible = true;
                    Panel2.Visible = false;
                    Panel3.Visible = false;

                }
                else
                {
                    RGP.BLL.Users bll = new RGP.BLL.Users();
                    loginname.Text = SessionBox.GetUserSession().LoginName;

                    ArrayList Role = SessionBox.GetUserSession().RoleID;
                    if (Role.Count != 0)
                    {                       
                        string sid = string.Empty;
                        string sname = string.Empty;
                        for (int i = 0; i < Role.Count; i++)
                        {
                            sid += Role[i].ToString().Split(',')[0] + ",";
                            sname += Role[i].ToString().Split(',')[1] + ",";
                        }

                        string[] id=sid.Substring(0, sid.Length - 1).Split(',');
                        string[] name=sname.Substring(0, sname.Length - 1).Split(',');
                        string s = TypeParse.MinStr(id);                        
                        Lab_rolename.Text = name[TypeParse.ReturnStringSeat(s,id)];
                    
                    }
                    else
                    {
                        Lab_rolename.Text = "系统超级管理员";
                    }
                    Panel1.Visible = false;
                    Panel2.Visible = true;
                    Panel3.Visible = true;
                }
            }
        }
    }
}
